HIVE-29584: Invalidate RawStore after Direct SQL connection failures - #6664
Draft
gaoxq wants to merge 1 commit into
Draft
HIVE-29584: Invalidate RawStore after Direct SQL connection failures#6664gaoxq wants to merge 1 commit into
gaoxq wants to merge 1 commit into
Conversation
Preserve JDBC connection errors and remove the cached RawStore before shutdown, allowing RetryingHMSHandler to retry with a fresh PersistenceManager. Make post-shutdown rollback idempotent so outer handler cleanup cannot mask the original failure. Co-Authored-By: GPT-5 Codex <noreply@openai.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What changes were proposed in this pull request?
When Direct SQL fails with a JDBC connection-level error, invalidate and shut
down the RawStore cached in
HMSHandlerContextinstead of falling back to ORMwith the same broken PersistenceManager/connection.
The change:
SQLExceptionfromMetaStoreDirectSql.prepareTxn();08and JDBC connection exception subclasses;RetryingHMSHandlercan retry;Why are the changes needed?
After a transient metastore database communication failure, a handler thread
can retain a closed connection through its cached PersistenceManager. HikariCP
cannot replace that connection while the wrapper remains in use, so later RPCs
on the same handler thread can repeatedly fail with
Connection is closeduntil HMS is restarted.
JIRA: https://issues.apache.org/jira/browse/HIVE-29584
How was this patch tested?
08S01that verifies no ORM fallback,RawStore invalidation, preservation of the JDO-backed error, and safe outer
transaction rollback. The test failed with an NPE before the cleanup fix and
passes afterward.
TestObjectStore#testDirectSqlConnectionErrorInvalidatesRawStoreTestObjectStore#testDirectSqlErrorMetricsTestObjectStore#testNoJdoForUnrecoverableExceptionTestRetriesInRetryingHMSHandler#testWrappedMetaExceptionRetrymvn -pl standalone-metastore/metastore-server -DskipTests checkstyle:check